import 'package:flutter/widgets.dart';
import 'package:freedom/webrtc/user_peer_connnection.dart';

class MahjongRoomInfoProvider with ChangeNotifier {
  bool showTips = false;
  List<int> cardList = [];

  String? swapCardIn;
  String? swapCardOut;

  UserPeerConnection? userPeerConnection;

  MahjongRoomInfoProvider({this.swapCardIn, this.swapCardOut});
  void updateCardList(List<int> cardList) {
    this.cardList = cardList;
    notifyListeners();
  }

  void updateState(bool show, List<int> cardList) {
    this.cardList = cardList;
    showTips = show;
    notifyListeners();
  }

  void updateSwapCardIn(String? swapCardIn) {
    this.swapCardIn = swapCardIn;
    notifyListeners();
  }

  void updateSwapCardOut(String? swapCardOut) {
    this.swapCardOut = swapCardOut;
    notifyListeners();
  }

  void updateSwapCard(String? swapCardIn, String? swapCardOut) {
    this.swapCardIn = swapCardIn;
    this.swapCardOut = swapCardOut;
    notifyListeners();
  }

  void updatePeerConnection(UserPeerConnection pc) {
    userPeerConnection = pc;
    notifyListeners();
  }

  void updateShowState(bool show) {
    showTips = show;
    notifyListeners();
  }

  void cleanTips() {
    showTips = false;
    cardList = [];
    notifyListeners();
  }
}
